package com.huawang.ecolink.apps.common;

import org.springframework.beans.BeansException;
import org.springframework.boot.ExitCodeGenerator;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

@Component
public class ServiceUtil implements ApplicationContextAware {
    private  ApplicationContext context;
    public int exeShutDown(){

        return SpringApplication.exit(context, (ExitCodeGenerator) () -> 0);
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        context = applicationContext;
    }
}
